//
//  RBAfterSalesAlertView.m
//  zhongzhenglu
//
//  Created by 马军凯 on 2023/5/6.
//

#import "RBAfterSalesAlertView.h"
#import "RBApplyRefundVC.h"
#import "RBApplyAfterSalesVC.h"

@implementation RBAfterSalesAlertView

//单例
+ (RBAfterSalesAlertView *)share {
    static RBAfterSalesAlertView *share = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        share = [[self alloc] init];
    });
    return share;
}

//2个
+ (void)showTwoBtnWith:(RBAfterSalesModel *)model {
    UIAlertController *vc = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    //
    UIAlertAction *aAction = [UIAlertAction actionWithTitle:@"申请退款" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        [[RBAfterSalesAlertView share] refundAction];
    }];
    [vc addAction:aAction];
    
    UIAlertAction *bAction = [UIAlertAction actionWithTitle:@"申请售后" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        
        [[RBAfterSalesAlertView share] afterSalesAction];
    }];
    [vc addAction:bAction];
    
    //取消
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    [vc addAction:cancelAction];
    
    [[UIApplication getCurrentVC] presentViewController:vc animated:YES completion:nil];
}

+ (void)showRefundWith:(RBAfterSalesModel *)model {
    UIAlertController *vc = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    //
    UIAlertAction *aAction = [UIAlertAction actionWithTitle:@"申请退款" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        [[RBAfterSalesAlertView share] refundAction];
    }];
    [vc addAction:aAction];
    
    //取消
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    [vc addAction:cancelAction];
    
    [[UIApplication getCurrentVC] presentViewController:vc animated:YES completion:nil];
}

+ (void)showAfterSalesWith:(RBAfterSalesModel *)model {
    UIAlertController *vc = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    
    UIAlertAction *bAction = [UIAlertAction actionWithTitle:@"申请售后" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        
        [[RBAfterSalesAlertView share] afterSalesAction];
    }];
    [vc addAction:bAction];
    
    //取消
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    [vc addAction:cancelAction];
    
    [[UIApplication getCurrentVC] presentViewController:vc animated:YES completion:nil];
}

//退款
- (void)refundAction {
    RBApplyRefundVC *vc = RBApplyRefundVC.new;
    
    [[UIApplication getCurrentVC].navigationController pushViewController:vc animated:YES];
}
//售后
- (void)afterSalesAction {
    RBApplyAfterSalesVC *vc = RBApplyAfterSalesVC.new;
    
    [[UIApplication getCurrentVC].navigationController pushViewController:vc animated:YES];
}


@end
